/**
 * Definition for a binary tree node.
 * public class TreeNode {
 *     int val;
 *     TreeNode left;
 *     TreeNode right;
 *     TreeNode(int x) { val = x; }
 * }
 */
class Solution {
    int k,res;
    public int kthLargest(TreeNode root, int k) {
        this.k = k;
        postOrder(root);
        return res;
    }

    void postOrder(TreeNode root){
        if(root == null || k <= 0) return;
        postOrder(root.right);
        k--;
        if(k == 0) res = root.val;
        postOrder(root.left);

    }
}